package com.lin.mr.maizilaundry.myadapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.lin.mr.maizilaundry.R;

/**
 * Created by lenovog on 2016/7/7.
 */
public class FragmentMeAdapter extends BaseAdapter {
    private ImageView image_item;
    private TextView textView_item;
    private Context context;
    private String[] names = {"我的订单","洗衣币","我的地址","分享推荐码","验证推荐码"};
    private int[] icons = {R.drawable.fragment_me_order,
            R.drawable.fragment_me_money,
            R.drawable.fragment_me_address,
            R.drawable.fragment_me_share,
            R.drawable.fragment_me_check,

    };

    public FragmentMeAdapter(Context context){
        this.context = context;
    }
    @Override
    public int getCount() {
        return names.length;
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = View.inflate(context,R.layout.fragment_me_item,null);
        image_item = (ImageView) view.findViewById(R.id.image_item);
        textView_item = (TextView) view.findViewById(R.id.textView_item);

        //将数组中的图片和文字加载到控件中
        image_item.setImageResource(icons[position]);
        textView_item.setText(names[position]);
        return view;
    }
}
